package com.gitee.mrj.aiboot.annotation.config.sf.type;

import com.gitee.mrj.aiboot.annotation.config.SFFormat;
import org.springframework.core.annotation.AliasFor;
import org.springframework.core.annotation.Order;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Documented
@AlainField
@Order(100)
public @interface AlainString {


    /**
     * 定义字符串的最大长度
     */
    int maxLength() default Integer.MIN_VALUE;

    /**
     * 定义字符串的最小长度
     */
    int minLength() default Integer.MIN_VALUE;

    /**
     * 验证输入字段正则表达式字符串
     */
    String pattern() default "";


    @AliasFor(annotation = AlainField.class)
    String title();

    /**
     * 必填项属性
     */
    @AliasFor(annotation = AlainField.class)
    boolean required() default false;

    /**
     * 属性目的性解释
     *
     * @return
     */
    @AliasFor(annotation = AlainField.class)
    String description() default "";


    /**
     * 默认值
     */

    String defaultValue() default "";

    SFFormat format() default SFFormat.NULL;

    /**
     * 是否只读状态
     */
    @AliasFor(annotation = AlainField.class)
    boolean readOnly() default false;
}
